package com.bill99.rpc.container;

import com.bill99.rpc.common.util.NetUtils;
import com.bill99.rpc.container.tomcat.TomcatServer;

/**
 * @author sheng.zhang
 */
public class ServerInfo {

	private String ip;
	private int port;
	private String path;

	private static ServerInfo serverInfo;

	private ServerInfo(String ip, int port, String path) {
		this.ip = ip;
		this.port = port;
		this.path = path;
	}

	public static synchronized ServerInfo getServerInfo() {
		if (serverInfo == null) {
			String ip = NetUtils.getIp();
			serverInfo = new ServerInfo(ip, TomcatServer.getPort(),
					TomcatServer.getPath());
		}
		return serverInfo;
	}

	public String getIp() {
		return ip;
	}

	public int getPort() {
		return port;
	}

	public String getPath() {
		return path;
	}

}
